package com.study.langchain4j.util;

import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

/**
 * @author xl-9527
 * @since 2025/10/31
 */
@Component
@SuppressWarnings("unchecked")
public class RedisOpcTemplate {

    private final RedisTemplate<String, Object> redisTemplate;

    public RedisOpcTemplate(final RedisTemplate<String, Object> redisTemplate) {
        this.redisTemplate = redisTemplate;
    }

    public <T> T get(final String key) {
        return (T) redisTemplate.opsForValue().get(key);
    }

    public void set(final String key, final Object value) {
        redisTemplate.opsForValue().set(key, value);
    }

    public void delete(final String key) {
        redisTemplate.delete(key);
    }
}
